import { login } from '@/apiUrl/login'
const user = {
    state: {
      token: '',
      businessId:"",
      sessionId:""
    },
  
    mutations: {
      SET_BUSINESSID: (state, businessId) => {
        state.businessId = businessId
      },
      SET_SESSIONID: (state, sessionId) => {
        state.sessionId = sessionId
      },
      SET_TOKEN: (state, token) => {
        state.token = token
      },

    },
  
    actions: {
      // 登录
      Login ({ commit }, loginInfo) {
        return new Promise((resolve, reject) => {
          login(loginInfo).then(res => {
            console.log(res.data.data.token)
            commit('SET_TOKEN', res.data.data.token)
            resolve()
          }).catch(error => {
            reject(error)
          })
        })
      }, 
    }
  }
export default user
